home *** CD-ROM | disk | FTP | other *** search
- Unit BD2_Max; {Primitive 2-Dimensional BufferedArrays}
- {$R-}
-
- INTERFACE
-
- Uses BND_Max;
-
- Type
-
- D2_BufferedArray = Object (BN_Max)
-
- Procedure Init (ElementsPerDimension : DimensionPtr;
- ElementSize : Word; MaxBuffSize : LongInt;
- FileName : String);
-
- Procedure Accept (X,Y : LongInt; Var El; Size : Word);
- {Assign the Addressed El}
-
- Procedure Retrieve (X,Y : LongInt; Var El; Size : Word);
- {Get the Addressed El}
-
-
- Procedure Swap (X1,Y1,X2,Y2 : LongInt);
- {Swap the 1 and 2 Element}
-
- Procedure Copy (From : D2_BufferedArray);
- {Target *MUST* already be initialized}
- {to the EXACT same parameters as From}
- {this will save checking for sufficient}
- {available Memory!}
-
- (* no redefinition needed
-
-
- Function MaxIndex (Index : Byte) : LongInt;
- {Return the Max legal Index}
- {for the Indexth Dimension}
-
- Function MaxSize : LongInt;
- {Report Total Number of Array Elements}
-
- Function ElemSize : Word; {Report Element Size}
-
- Procedure Destroy;
- *)
- End; {D2_BufferedArray}
-
-
-
- IMPLEMENTATION
-
-
- Procedure D2_BufferedArray.Init;
- Begin
- BN_Max.Init (2,ElementsPerDimension,ElementSize,MaxBuffSize,FileName)
- End;
-
- Procedure D2_BufferedArray.Accept (X,Y : LongInt; Var El; Size : Word);
- {Assign the Addressed El}
- Var
- I : Byte;
- Begin
- I := 0;
- Add1^[I] := X; {even with range-checking off, the}
- I := 1;
- Add1^[I] := Y; {compiler generates an error if}
- {a constant is used here. Dunno why...}
- BN_Max.Accept (El,Add1,2,Size)
- End;
-
- Procedure D2_BufferedArray.Retrieve (X,Y : LongInt; Var El; Size : Word);
- {Get the Addressed El}
- Var
- I : Byte;
- Begin
- I := 0;
- Add1^[I] := X;
- I := 1;
- Add1^[I] := Y;
- BN_Max.Retrieve (El,Add1,2,Size)
- End;
-
- Procedure D2_BufferedArray.Swap (X1,Y1,X2,Y2 : LongInt);
- {Swap the 1 and 2 Element}
- Var
- I : Byte;
- Begin
- I := 0;
- Add1^[I] := X1;
- Add2^[I] := X2;
- I := 1;
- Add1^[I] := Y1;
- Add2^[I] := Y2;
- BN_Max.Swap (Add1,Add2,2)
- End;
-
- Procedure D2_BufferedArray.Copy (From : D2_BufferedArray);
- {Redefined purely for type-checking}
- Begin
- BN_Max.Copy (From)
- End;
-
- BEGIN
- END.